<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico"> 
	<link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/page.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/double-date.css" rel="stylesheet">
    <script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/admin/js/double-date.js"></script>
</head>

<style>
.table1 .xinxiinfo1{
	width:13%;
	height:50px;
	text-align:right;
	background-color:#F5F5F6;
}
.table1 .xinxiinfo2{
	width:87%;
	height:50px;
	text-align:left;
}
</style>

<body class="gray-bg" >

    <div class="wrapper wrapper-content" style="padding-bottom:0px;">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>售后商品信息</h5>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-hover table-bordered">
                            <thead>
                                <tr>
                                    <th style="width:15%">缩略图</th> 
                                    <th style="width:20%">商品名称</th>
                                    <th style="width:15%">商品属性</th>
                                    <th style="width:10%">商品单价</th>
                                    <th style="width:10%">退换数量</th> 
                                    <th style="width:10%">状态</th>
                                </tr>
                            </thead>
                        
                            <tbody>
                                <tr>
                                <td><img src="{$order_goods.thumb_url}" width="125px" height="75px" /></td>
                                <td>{$order_goods.goods_name}</td>
                                <td>{$order_goods.goods_attr_str}</td>
                                <td>{$order_goods.price}&nbsp;元</td>
                                <td>{$applys.tui_num}</td>
                                <td>
                                {switch name="order_goods.th_status"}
                                {case value="0"}<font style="color:#1992FC;">正常</font>{/case}
                                {case value="1"}<font style="color:#f8ac59;">申请退款中</font>{/case}
                                {case value="2"}<font style="color:#f8ac59;">退款中</font>{/case}
                                {case value="3"}<font style="color:#F00;">拒绝退款</font>{/case}
                                {case value="4"}<font style="color:#1992FC;">退款完成</font>{/case}
                                {case value="5"}<font style="color:#f8ac59;">申请换货中</font>{/case}
                                {case value="6"}<font style="color:#f8ac59;">换货中</font>{/case}
                                {case value="7"}<font style="color:#F00;">拒绝换货</font>{/case}
                                {case value="8"}<font style="color:#1992FC;">换货完成</font>{/case}
                                {/switch}
                                </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <div class="wrapper wrapper-content" style="padding-bottom:0px;">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>售后信息</h5>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-bordered table1">
                            <tbody>
                                <tr><td class="xinxiinfo1">售后流水号：</td><td class="xinxiinfo2">{$applys.th_number}</td></tr>
                                <tr>
                                <td class="xinxiinfo1">退换种类：</td><td class="xinxiinfo2">{$applys.cate_name}</td></tr>
                                <tr>
                                <td class="xinxiinfo1">状态：</td>
                                <td class="xinxiinfo2">
                                {switch name="applys.apply_status"}
                                {case value="0"}<font style="color:#1c84c6;">待审核</font>{/case}
                                {case value="1"}<font style="color:#1c84c6;">售后中</font>{/case}
                                {case value="2"}<font style="color:#F00;">已拒绝</font>{/case}
                                {case value="3"}<font style="color:#1992FC;">已完成</font>{/case}
                                {case value="4"}<font style="color:#1992FC;">用户已撤销</font>{/case}
                                {/switch}
                                </td>
                                </tr>
                                
                                {switch name="applys.apply_status"}
                                {case value="1"}
                                <tr><td class="xinxiinfo1">同意申请时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$applys['agree_time'])}</td></tr>
                                {/case}
                                {case value="2"}
                                <tr><td class="xinxiinfo1">拒绝申请时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$applys['refuse_time'])}</td></tr>
                                <tr><td class="xinxiinfo1">拒绝原因：</td><td class="xinxiinfo2">{$applys.refuse_reason}</td></tr>
                                {/case}
                                {case value="3"}
                                <tr><td class="xinxiinfo1">完成时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$applys['com_time'])}</td></tr>
                                {/case}
                                {case value="4"}
                                <tr><td class="xinxiinfo1">撤销时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$applys['che_time'])}</td></tr>
                                {/case}
                                {/switch} 
                                
                                <tr><td class="xinxiinfo1">会员昵称：</td><td class="xinxiinfo2">{if condition="$applys['user_name']"}{$applys.user_name}{else/}/{/if}</td></tr>
                                <tr><td class="xinxiinfo1">手机号：</td><td class="xinxiinfo2">{$applys.phone}</td></tr>
                                {if condition="$applys['thfw_id'] neq 3"}
                                <tr><td class="xinxiinfo1">退款金额：</td><td class="xinxiinfo2">{$applys.tui_price}&nbsp;元</td></tr>
                                {/if}
                                {if condition="$applys['thfw_id'] eq 1"}
                                <tr>
                                <td class="xinxiinfo1">会员收货状态：</td>
                                <td class="xinxiinfo2">
                                {switch name="applys.sh_type"}
                                {case value="1"}<font style="color:#1c84c6;">未收货</font>{/case}
                                {case value="2"}<font style="color:#1c84c6;">已收货</font>{/case}
                                {/switch}
                                </td>
                                </tr>
                                {/if}
                                <tr><td class="xinxiinfo1">退款原因：</td><td class="xinxiinfo2">{$applys.th_reason}</td></tr>
                                <tr><td class="xinxiinfo1">退款说明：</td><td class="xinxiinfo2">{$applys.th_content}</td></tr>
                                <tr>
                                <td class="xinxiinfo1">凭证图片：</td>
                                <td class="xinxiinfo2">
                                {if condition="!empty($thpicres)"}
                                {foreach name="thpicres" item="v"}
                                <div style="float:left; margin-right:10px; margin-bottom:10px;"><img src="{$v.img_url|url_format}" width="180px" /></div>
                                {/foreach}
                                {/if}
                                </td>
                                </tr>
                                {if condition="in_array($applys['thfw_id'],array(2,3)) && in_array($applys['apply_status'],array(1,3))"}
                                <tr><td class="xinxiinfo1">会员退货状态：</td><td class="xinxiinfo2">{switch name="$applys['dcfh_status']"}{case value="0"}未发货{/case}{case value="1"}已发货{/case}{/switch}</td></tr>
                                {if condition="$applys['dcfh_status'] eq 1"} 
                                <tr><td class="xinxiinfo1">会员退货时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$applys['dcfh_time'])}</td></tr>  
                                <tr><td class="xinxiinfo1">物流公司：</td><td class="xinxiinfo2">{$tuiwulius.ps_name}</td></tr>   
                                <tr><td class="xinxiinfo1">物流单号：</td><td class="xinxiinfo2">{$tuiwulius.ps_num}</td></tr>  
                                <tr><td class="xinxiinfo1">联系电话：</td><td class="xinxiinfo2">{$tuiwulius.telephone}</td></tr>  
                                <tr><td class="xinxiinfo1">商家确认收货状态：</td><td class="xinxiinfo2">{switch name="$applys['sh_status']"}{case value="0"}未确认收货{/case}{case value="1"}已确认收货{/case}{/switch}</td></tr>                        
                                {/if}
                                {if condition="$applys['dcfh_status'] eq 1 && $applys['sh_status'] eq 1"} 
                                <tr><td class="xinxiinfo1">商家确认收货时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$applys['sh_time'])}</td></tr>                          
                                {/if}
                                {if condition="$applys['thfw_id'] eq 3"}
                                {if condition="$applys['dcfh_status'] eq 1 && $applys['sh_status'] eq 1"}
                                <tr><td class="xinxiinfo1">商家发货状态：</td><td class="xinxiinfo2">{switch name="$applys['fh_status']"}{case value="0"}未发货{/case}{case value="1"}已发货{/case}{/switch}</td></tr>
                                {/if}
                                {if condition="$applys['dcfh_status'] eq 1 && $applys['sh_status'] eq 1 && $applys['fh_status'] eq 1"} 
                                <tr><td class="xinxiinfo1">商家发货时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$applys['fh_time'])}</td></tr>  
                                <tr><td class="xinxiinfo1">物流公司：</td><td class="xinxiinfo2">{$wulius.log_name}</td></tr>   
                                <tr><td class="xinxiinfo1">物流单号：</td><td class="xinxiinfo2">{$wulius.psnum}</td></tr>  
                                <tr><td class="xinxiinfo1">联系电话：</td><td class="xinxiinfo2">{$wulius.telephone}</td></tr> 
                                <tr><td class="xinxiinfo1">会员确认收货状态：</td><td class="xinxiinfo2">{switch name="$applys['shou_status']"}{case value="0"}未确认收货{/case}{case value="1"}已确认收货{/case}{/switch}</td></tr>
                                {/if}
                                {if condition="$applys['dcfh_status'] eq 1 && $applys['sh_status'] eq 1 && $applys['fh_status'] eq 1 && $applys['shou_status'] eq 1"} 
                                <tr><td class="xinxiinfo1">会员确认收货时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$applys['shou_time'])}</td></tr>
                                {/if}
                                {/if}
                                {/if}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <div class="wrapper wrapper-content" style="padding-bottom:0px;">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>订单基本信息</h5>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-bordered table1">
                            <tbody>
                                <tr><td class="xinxiinfo1">订单号：</td><td class="xinxiinfo2">{$orders.ordernumber}</td></tr>
                                <tr>
                                <td class="xinxiinfo1">订单状态：</td>
                                <td class="xinxiinfo2">
                                {switch name="orders.zhuangtai"}
                                {case value="1"}<font style="color:#1c84c6;">待发货</font>{/case}
                                {case value="2"}<font style="color:#1c84c6;">待收货</font>{/case}
                                {case value="3"}<font style="color:#1992FC;">已完成</font>{/case}
                                {case value="4"}<font style="color:#1c84c6;">待支付</font>{/case}
                                {case value="5"}<font style="color:#F00;">已关闭</font>{/case}
                                {/switch}
                                </td>
                                </tr>		
                                <tr><td class="xinxiinfo1">总价：</td><td class="xinxiinfo2">{$orders.total_price}&nbsp;元</td></tr>	
                                <tr><td class="xinxiinfo1">订单提交时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$orders['addtime'])}</td></tr>		
                                <tr><td class="xinxiinfo1">会员昵称：</td><td class="xinxiinfo2">{if condition="$orders['user_name']"}{$orders.user_name}{else/}/{/if}</td></tr>	
                                <tr><td class="xinxiinfo1">会员手机：</td><td class="xinxiinfo2">{$orders.phone}</td></tr>	
                                <tr><td class="xinxiinfo1">会员所属区域：</td><td class="xinxiinfo2">{$orders.pro_name}&nbsp;{$orders.city_name}&nbsp;{$orders.area_name}</td></tr>	
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <input type="hidden" name="orderid" value="{$orders.id}">
    <input type="hidden" name="id" value="{$applys.id}">
    {if condition="in_array($applys['apply_status'],array(0,1))"}
    <div class="wrapper wrapper-content" style="padding-bottom:0px;">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>操作</h5>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-bordered table1">
                            <tbody>
                                {if condition="$applys['apply_status'] eq 0"}
                                <tr>
                                <td class="xinxiinfo1">是否同意申请：</td>
                                <td class="xinxiinfo2">
                                <div id="atype">
                                <label class="radio-inline"><input type="radio" name="apply_status" value="1">同意</label>
                                <label class="radio-inline"><input type="radio" name="apply_status" value="2">拒绝</label>
                                </div>
                                </td>
                                </tr>
                                <tr class="adurl" style="display:none;"></tr>
                                <tr class="adurl" style="display:none;">
                                <td class="xinxiinfo1">拒绝原因：</td>
                                <td class="xinxiinfo2">
                                <textarea name="refuse_reason" id="refuse_reason" class="form-control"></textarea>
                                </td>
                                </tr>
                                <tr>
                                <input type="hidden" name="id" value="{$applys.id}">
                                <td colspan="2" style="text-align:center; font-size:14px;"><button class="btn btn-primary" type="button" id="doSubmitty" style="margin-right:50px;">保存信息</button></td>、
                                </tr>
                                {elseif condition="$applys['apply_status'] eq 1" /}
                                {if condition="$applys['thfw_id'] eq 1"}
                                <tr>
                                <input type="hidden" name="id" value="{$applys.id}">
                                <td colspan="2" style="text-align:center; font-size:14px;"><button class="btn btn-primary" type="button" id="doSubmitcom" style="margin-right:50px;">确定完成</button></td>
                                </tr>                                 
                                {elseif condition="in_array($applys['thfw_id'],array(2,3)) && $applys['dcfh_status'] eq 1 && $applys['sh_status'] eq 0" /}
                                <tr>
                                <input type="hidden" name="id" value="{$applys.id}">
                                <td colspan="2" style="text-align:center; font-size:14px;"><button class="btn btn-primary" type="button" id="doSubmitqrsh" style="margin-right:50px;">确认收货</button></td>
                                </tr>
                                {elseif condition="in_array($applys['thfw_id'],array(2,3)) && $applys['dcfh_status'] eq 1 && $applys['sh_status'] eq 1" /}
                                {if condition="$applys['thfw_id'] eq 2"}
                                <tr>
                                <input type="hidden" name="id" value="{$applys.id}">
                                <td colspan="2" style="text-align:center; font-size:14px;"><button class="btn btn-primary" type="button" id="doSubmitcom" style="margin-right:50px;">确定完成</button></td>、
                                </tr>
                                {elseif condition="$applys['thfw_id'] eq 3" /}
                                <tr><td class="xinxiinfo1">收货人姓名：</td><td class="xinxiinfo2">{$applys.contacts}</td></tr> 
                                <tr><td class="xinxiinfo1">手机号：</td><td class="xinxiinfo2">{$applys.telephone}</td></tr>  
                                <tr><td class="xinxiinfo1">省市区：</td><td class="xinxiinfo2">{$applys.shengshiqu}</td></tr> 
                                <tr><td class="xinxiinfo1">详细地址：</td><td class="xinxiinfo2">{$applys.address}</td></tr> 
                                <tr>
                                <td class="xinxiinfo1">选择物流：</td>
                                <td class="xinxiinfo2">
                                   <select class="form-control m-b" name="ps_id" id="wuliu">
                                         <option value="">请选择</option>
                                         {foreach name="psres" item="v"}
                                         <option value="{$v.id}" {if condition="isset($wulius['ps_id']) && $wulius['ps_id'] eq $v['id']"}selected="selected"{/if}>{$v.log_name}</option>
                                         {/foreach}                                                                             
                                    </select>
                                </td>
                                </tr>
                                <tr>
                                <td class="xinxiinfo1">运单号：</td>
                                <td class="xinxiinfo2">
                                <input type="text" name="psnum" {if condition="isset($wulius['psnum']) && $wulius['psnum']"}value="{$wulius.psnum}"{/if} class="form-control">
                                </td>
                                </tr>
                                <tr>
                                <input type="hidden" name="id" value="{$applys.id}">
                                <td colspan="2" style="text-align:center; font-size:14px;"><button class="btn btn-primary" type="button" id="doSubmitfh" style="margin-right:50px;">保存发货信息</button>{if condition="$applys['fh_status'] eq 0"}<button type="button" class="btn btn-success" id="doSubmitqr">确认发货</button>{/if}</td>
                                </tr> 
                                {/if}                               
                                {/if}
                                {/if}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {/if}
    
    <!-- 全局js -->
    <script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
    <script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__PUBLIC__/admin/js/plugins/validate/jquery.validate.min.js"></script>
    <!-- iCheck -->
    <script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script> 
    <script src="__PUBLIC__/admin/js/common/ajax.js"></script>
    
    <script>
    $(function(){
    	
	$('#atype .radio-inline').click(function(){
		var i = $(this).index();
		$('.adurl').hide();
		$('.adurl').eq(i).show();
	});
		  
	$('#doSubmitty').click(function(){
  		  var apply_status = $('input:radio[name=apply_status]:checked').val();
  		  if(apply_status == null){
  			  layer.msg('请选择同意或拒绝', {icon: 2,time: 1000});
  			  return false;
  		  }
  			
  		  if('1,2'.indexOf(apply_status) == -1){
  			  layer.msg('参数错误', {icon: 2,time: 1000});
  			  return false;
  		  }
  		  
  		  var refuse_reason = $('#refuse_reason').val();
  		  
          var th_id = $('input[name=id]').val();
      	
      	  if(!th_id){
      		 layer.msg('缺少退换申请信息参数', {icon: 2,time: 2000});
      		 return false;
      	  }
  		  
  		  if(apply_status == 1){
  			  var shuoming = '确定同意么？不可撤销';
  		  }
  		  
  		  if(apply_status == 2){
  			  var shuoming = '确定拒绝么？不可撤销';
			  if(refuse_reason == ''){
				  layer.msg('请填写拒绝原因', {icon: 2,time: 1000});
    			  return false;
			  }
  		  }
  		  
          layer.confirm(shuoming, {  			  
  			  skin: 'layui-layer-molv',
  			  closeBtn: 0,
  			  shadeClose : true,
  			  btn: ['确定','取消'] //按钮
  		  },function(){
  			  layer.load(2);
  		      $.ajax({
  			      url:"{:url('th_apply/checked')}",
  			      type:'POST',
  			      data:{'apply_status':apply_status,'refuse_reason':refuse_reason,'th_id':th_id},
  			      dataType:'json',
  			      success:function(data){
  			    	  if(data.status == 1){
  			    		  layer.closeAll('loading');
  	  			          layer.msg(data.mess, {icon: 1,time: 1000},function(){
  	  			        	  location.reload();
  	  			          });
  			    	  }else if(data.status == 0){
  	  					  layer.closeAll('loading');
  	  					  layer.msg(data.mess, {icon: 2,time: 2000});
  			    	  }
  			      },
  			      error:function(){
  			    	  layer.closeAll('loading');
  			    	  layer.msg('操作失败，请重试', {icon: 2,time: 2000});
  			      }
  			});
  		});
  	});   
	
	$('#doSubmitcom').click(function(){
        var th_id = $('input[name=id]').val();
    	
    	if(!th_id){
    	    layer.msg('缺少退换申请信息参数', {icon: 2,time: 2000});
    		return false;
    	}
		  
        layer.confirm('确定已完成么？不可撤销', {  			  
			  skin: 'layui-layer-molv',
			  closeBtn: 0,
			  shadeClose : true,
			  btn: ['确定','取消'] //按钮
		},function(){
			  layer.load(2);
		      $.ajax({
			      url:"{:url('th_apply/complete')}",
			      type:'POST',
			      data:{'th_id':th_id},
			      dataType:'json',
			      success:function(data){
			    	  if(data.status == 1){
			    		  layer.closeAll('loading');
	  			          layer.msg(data.mess, {icon: 1,time: 1000},function(){
	  			        	  location.reload();
	  			          });
			    	  }else if(data.status == 0){
	  					  layer.closeAll('loading');
	  					  layer.msg(data.mess, {icon: 2,time: 2000});
			    	  }
			      },
			      error:function(){
			    	  layer.closeAll('loading');
			    	  layer.msg('操作失败，请重试', {icon: 2,time: 2000});
			      }
			});
		});
	}); 
	
	$('#doSubmitqrsh').click(function(){
        var th_id = $('input[name=id]').val();
    	
    	if(!th_id){
    	    layer.msg('缺少退换申请信息参数', {icon: 2,time: 2000});
    		return false;
    	}
		  
        layer.confirm('确定已收货吗？不可撤销', {
			  skin: 'layui-layer-molv',
			  closeBtn: 0,
			  shadeClose : true,
			  btn: ['确定','取消'] //按钮
		},function(){
			  layer.load(2);
		      $.ajax({
			      url:"{:url('th_apply/qrshouhuo')}",
			      type:'POST',
			      data:{'th_id':th_id},
			      dataType:'json',
			      success:function(data){
			    	  if(data.status == 1){
			    		  layer.closeAll('loading');
	  			          layer.msg(data.mess, {icon: 1,time: 1000},function(){
	  			        	  location.reload();
	  			          });
			    	  }else if(data.status == 0){
	  					  layer.closeAll('loading');
	  					  layer.msg(data.mess, {icon: 2,time: 2000});
			    	  }
			      },
			      error:function(){
			    	  layer.closeAll('loading');
			    	  layer.msg('操作失败，请重试', {icon: 2,time: 2000});
			      }
			});
		});
	}); 

	
    $('#doSubmitfh').click(function(){
    	var ps_id = $('#wuliu').val();
    	if(!ps_id){
    		layer.msg('请选择物流', {icon: 2,time: 2000});
    		return false;
    	}
    	
    	var psnum = $('input[name=psnum]').val();
    	if(psnum == ''){
    		layer.msg('请填写运单号', {icon: 2,time: 2000});
    		return false;
    	}
    	
    	var th_id = $('input[name=id]').val();
    	
    	if(!th_id){
    		layer.msg('缺少退换申请信息', {icon: 2,time: 2000});
    		return false;
    	}
    	
    	layer.load(2);
    	
		$.ajax({
			   url:"{:url('th_apply/savewuliu')}",
			   type:'POST',
			   data:{'ps_id':ps_id,'psnum':psnum,'th_id':th_id},
		       dataType:'json',
			   success:function(data){
					if(data.status == 1){
						layer.closeAll('loading');
			        	layer.msg(data.mess, {icon: 1,time: 1000},function(){
			        		location.reload();
			         	});	
					}else{
						layer.closeAll('loading');
						layer.msg(data.mess, {icon: 2,time: 2000});
					}
			   },
		       error:function(){
		           layer.closeAll('loading');
		           layer.msg('操作失败或您没有权限，请重试', {icon: 2,time: 2000});
		       }
		    });
    });
    

    $('#doSubmitqr').click(function(){
  		layer.confirm('确定发货么？', {  			  
			skin: 'layui-layer-molv',
			closeBtn: 0,
			shadeClose : true,
			btn: ['确定','取消'] //按钮
		},function(){
        	var ps_id = $('#wuliu').val();
        	if(!ps_id){
        		layer.msg('请选择物流', {icon: 2,time: 2000});
        		return false;
        	}
        	
        	var psnum = $('input[name=psnum]').val();
        	if(psnum == ''){
        		layer.msg('请填写运单号', {icon: 2,time: 2000});
        		return false;
        	}
        	
        	var th_id = $('input[name=id]').val();
        	
        	if(!th_id){
        		layer.msg('缺少退换申请信息', {icon: 2,time: 2000});
        		return false;
        	}
        	
        	layer.load(2);
        	
    		$.ajax({
  			   url:"{:url('th_apply/fachu')}",
  			   type:'POST',
  			   data:{'th_id':th_id},
  		       dataType:'json',
  			   success:function(data){
 					if(data.status == 1){
 						layer.closeAll('loading');
 			        	layer.msg(data.mess, {icon: 1,time: 1000},function(){
 			        		location.reload();
 			         	});	
 					}else{
 						layer.closeAll('loading');
 						layer.msg(data.mess, {icon: 2,time: 2000});
 					}
 			   },
 		       error:function(){
 		           layer.closeAll('loading');
 		           layer.msg('操作失败或您没有权限，请重试', {icon: 2,time: 2000});
 		       }
  		    });
		}); 
    });
 	
    });
    </script>

</body>
</html>